package com.pjh.shitang.controller;

import com.pjh.shitang.services.WindowService;
import com.pjh.shitang.utils.vo.receive.PageInfo;
import com.pjh.shitang.utils.vo.returns.DataWithLike;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author yueyinghaibao
 * @date 2022/5/6
 */
@Api(value = "窗口相关接口", tags = "窗口接口")
@RestController
@RequestMapping("/window")
public class WindowController {

    @Resource
    WindowService windowService;

    @ApiOperation("分页查询")
    @PostMapping("/page")
    public List<DataWithLike<Object>> page(@RequestBody PageInfo info) {
        return windowService.queryPage(info);
    }

    @ApiOperation("随机菜肴，返回window和food")
    @GetMapping("/random")
    public Map<String, Object> random(@RequestParam("code") Integer code) {
        return windowService.dinnerRoll(code);
    }
}
